//
//  HGSubMoviewPorCollectionViewCell.m
//  悦享
//
//  Created by dllo on 16/3/19.
//  Copyright © 2016年 张洪国. All rights reserved.
//

#import "HGSubMoviewPorCollectionViewCell.h"
#import <UIImageView+WebCache.h>

@implementation HGSubMoviewPorCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView1 = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageView1];
        
        self.backImageVIew = [[UIImageView alloc] init];
        [self.contentView addSubview:_backImageVIew];
        
        self.label = [[UILabel alloc] init];
        [self.contentView addSubview:_label];
    }
    return self;
}

- (void)setModel:(TVModel *)model{
    _model = model;
    
    [_imageView1 sd_setImageWithURL:[NSURL URLWithString:_model.picUrl] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    
    _backImageVIew.image = [UIImage imageNamed:@"1b3998baa4cb5c8254f0f2e64976599f.png"];
    _label.text = _model.name;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    _imageView1.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height);
    
    _imageView1.layer.cornerRadius = 5;
    _imageView1.layer.masksToBounds = YES;
    
    _backImageVIew.frame = CGRectMake(0, layoutAttributes.frame.size.height - 30, layoutAttributes.frame.size.width, 30);
    _label.frame = CGRectMake(5, layoutAttributes.frame.size.height - 25, layoutAttributes.frame.size.width - 10, 20);
    _label.textColor = [UIColor whiteColor];
    _label.font = [UIFont systemFontOfSize:13];
    
}

@end
